const express = require('express');
const router = express.Router();


let todos = [];


router.get('/',async(req,res) => {


    // 在响应中返回 json 数据
    res.json ({
        todoList:todos
    })
})

router.post('/',async (req,res) => {

    const {title,status} = req.body;
    console.log('res.body',res.body);
    todos.push({title,status});
    console.log(todos);
    res.json({
        sucess:true
    })
})


module.exports = router;